"""
pydantic 错误类型

- Doc: https://docs.pydantic.dev/2.10/errors/validation_errors/
"""

from devtools import debug

from my_typing import *


class PydanticError(NamedTuple):
    """ Pydantic 错误 """

    template_en: str
    """ 错误模板（英文） """

    template_zh_cn: str
    """ 错误模板（中文） """


class PydanticErrorCollection:
    """ Pydantic 错误集合 """

    arguments_type = PydanticError(
        template_en="Input should be a valid dictionary or instance of {class_name}",
        template_zh_cn="输入应为有效的字典或 {class_name} 的实例",
    )
    """
    参数类型错误

    This error is raised when an object that would be passed as arguments to a function during validation is 
    not a `tuple`, `list`, or `dict`. Because `NamedTuple` uses function calls in its implementation, that 
    is one way to produce this error:

    Translation:
        当在验证过程中，一个本应作为函数参数传递的对象不是元组（tuple）、列表（list）或字典（dict）时，就会引发此错误。
        因为 NamedTuple 在其实现中使用了函数调用，所以这是产生此错误的一种常见情况：

    Examples:
        from typing import NamedTuple
        from pydantic import BaseModel, ValidationError

        class MyNamedTuple(NamedTuple):
            x: int

        class MyModel(BaseModel):
            field: MyNamedTuple

        try:
            MyModel.model_validate({'field': 'invalid'})
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'arguments_type'

    References:
        - https://errors.pydantic.dev/2.10/v/arguments_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#arguments_type
    """

    assertion_error = PydanticError(
        template_en="Assertion failed",
        template_zh_cn="断言失败",
    )
    """
    断言错误

    This error is raised when a failing `assert` statement is encountered during validation:

    Translation:
        当验证过程中遇到失败的 assert 断言语句时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError, field_validator

        class Model(BaseModel):
            x: int

            @field_validator('x')
            @classmethod
            def force_x_positive(cls, v):
                assert v > 0
                return v

        try:
            Model(x=-1)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'assertion_error'

    References:
        - https://errors.pydantic.dev/2.10/v/assertion_error
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#assertion_error
    """

    bool_parsing = PydanticError(
        template_en="Input should be a valid boolean, unable to interpret input",
        template_zh_cn="输入应为有效的布尔值，无法解析输入内容",
    )
    """
    布尔值解析错误

    This error is raised when the input value is a string that is not valid for coercion to a boolean:

    Translation:
        当输入值是无法转换为布尔值的字符串时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: bool

        Model(x='true')  # OK

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'bool_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/bool_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#bool_parsing
    """

    bool_type = PydanticError(
        template_en="Input should be a valid boolean",
        template_zh_cn="输入应为有效的布尔值",
    )
    """
    布尔值类型错误

    This error is raised when the input value's type is not valid for a `bool` field:

    Translation:
        当输入值的类型不适用于 `bool` 字段时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: bool

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'bool_type'

    References:
        - https://errors.pydantic.dev/2.10/v/bool_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#bool_type
    """

    bytes_invalid_encoding = PydanticError(
        template_en="Data should be valid {encoding}",
        template_zh_cn="数据应为有效的 {encoding}",
    )
    """
    字节编码无效错误

    This error is raised when a `bytes` value is invalid under the configured encoding.
    In the following example, `b'a'` is invalid hex (odd number of digits).

    Translation:
        当 bytes 值在配置的编码下无效时，会引发此错误。在以下示例中，b'a' 是无效的十六进制（数字个数为奇数）。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: bytes
            model_config = {'val_json_bytes': 'hex'}

        try:
            Model(x=b'a')  # 实际运行无报错，换成下面那个才报错
            Model(x=b'a123xaw \a1\n\n\n\123__++\\你好')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'bytes_invalid_encoding'

    References:
        - https://errors.pydantic.dev/2.10/v/bytes_invalid_encoding
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#bytes_invalid_encoding
    """

    bytes_too_long = PydanticError(
        template_en="Data should have at most {max_length} bytes",
        template_zh_cn="数据最多应包含 {max_length} 个字节",
    )
    """
    字节长度过长错误

    This error is raised when the length of a `bytes` value is greater than the field's `max_length` constraint:

    Translation:
        当 `bytes` 值的长度超过字段的 `max_length` 限制时，会引发此错误。

    Examples:
    from pydantic import BaseModel, Field, ValidationError

    class Model(BaseModel):
        x: bytes = Field(max_length=3)

    try:
        Model(x=b'test')
    except ValidationError as exc:
        print(repr(exc.errors()[0]['type']))
        #> 'bytes_too_long'

    References:
        - https://errors.pydantic.dev/2.10/v/bytes_too_long
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#bytes_too_long
    """

    bytes_too_short = PydanticError(
        template_en="Data should have at least {min_length} bytes",
        template_zh_cn="数据至少应包含 {min_length} 个字节",
    )
    """
    字节长度过短错误

    This error is raised when the length of a `bytes` value is less than the field's `min_length` constraint:

    Translation:
        当 `bytes` 值的长度小于字段的 `min_length` 限制时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: bytes = Field(min_length=3)

        try:
            Model(x=b't')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'bytes_too_short'

    References:
        - https://errors.pydantic.dev/2.10/v/bytes_too_short
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#bytes_too_short
    """

    bytes_type = PydanticError(
        template_en="Input should be a valid bytes",
        template_zh_cn="输入应为有效的字节数据",
    )
    """
    字节类型错误

    This error is raised when the input value's type is not valid for a `bytes` field:

    Translation:
        当输入值的类型不适用于 `bytes` 字段时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: bytes

        try:
            Model(x=123)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'bytes_type'

    References:
        - https://errors.pydantic.dev/2.10/v/bytes_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#bytes_type
    """

    callable_type = PydanticError(
        template_en="Input should be callable",
        template_zh_cn="输入应为可调用对象",
    )
    """
    可调用对象类型错误

    This error is raised when the input value is not valid as a `Callable`:

    Translation:
        当输入值不是有效的`Callable`（可调用对象）时，会引发此错误。

    Examples:
        from typing import Any, Callable
        from pydantic import BaseModel, ImportString, ValidationError

        class Model(BaseModel):
            x: ImportString[Callable[[Any], Any]]

        Model(x='math:cos')  # OK

        try:
            Model(x='os.path')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'callable_type'

    References:
        - https://errors.pydantic.dev/2.10/v/callable_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#callable_type
    """

    complex_str_parsing = PydanticError(
        template_en="Input should be a valid complex string following the rules at https://docs.python.org/3/library/functions.html#complex",
        template_zh_cn="输入应为符合 Python 复数规则的字符串",
    )
    """
    复数字符串解析错误

    This error is raised when the input value is a string but cannot be parsed as a complex number 
    because it does not follow the rule in Python:

    Translation:
        当输入值为字符串但无法按照 Python 规则解析为复数时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            num: complex

        try:
            # Complex numbers in json are expected to be valid complex strings.
            # This value `abc` is not a valid complex string.
            Model.model_validate_json('{"num": "abc"}')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'complex_str_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/complex_str_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#complex_str_parsing
    """

    complex_type = PydanticError(
        template_en="Input should be a valid python complex object, a number, or a valid complex string following the rules at https://docs.python.org/3/library/functions.html#complex",
        template_zh_cn="输入应为有效的 Python 复数对象、数字或有效的复数格式字符串",
    )
    """
    复数类型错误

    This error is raised when the input value cannot be interpreted as a complex number:

    Translation:
        当输入值无法被解析为复数时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            num: complex

        try:
            Model(num=False)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'complex_type'

    References:
        - https://errors.pydantic.dev/2.10/v/complex_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#complex_type
    """

    dataclass_exact_type = PydanticError(
        template_en="Input should be an instance of {class_name}",
        template_zh_cn="输入应为 <{class_name}> 的实例",
    )
    """
    数据类实例错误

    This error is raised when validating a dataclass with `strict=True` 
    and the input is not an instance of the dataclass:

    Translation:
        当使用 `strict=True` 验证数据类 且 输入不是该数据类的实例时，会引发此错误。

    Examples:
        import pydantic.dataclasses
        from pydantic import TypeAdapter, ValidationError

        @pydantic.dataclasses.dataclass
        class MyDataclass:
            x: str

        adapter = TypeAdapter(MyDataclass)

        print(adapter.validate_python(MyDataclass(x='test'), strict=True))
        #> MyDataclass(x='test')
        print(adapter.validate_python({'x': 'test'}))
        #> MyDataclass(x='test')

        try:
            adapter.validate_python({'x': 'test'}, strict=True)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'dataclass_exact_type'

    References:
        - https://errors.pydantic.dev/2.10/v/dataclass_exact_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#dataclass_exact_type
    """

    dataclass_type = PydanticError(
        template_en="Input should be a dictionary or an instance of {class_name}",
        template_zh_cn="输入应为字典或 <{class_name}> 的实例",
    )
    """
    数据类类型错误

    This error is raised when the input value is not valid for a `dataclass` field:

    Translation:
        当输入值不适用于 `dataclass` 字段时，会引发此错误。

    Examples:
        from pydantic import ValidationError, dataclasses

        @dataclasses.dataclass
        class Inner:
            x: int

        @dataclasses.dataclass
        class Outer:
            y: Inner

        Outer(y=Inner(x=1))  # OK

        try:
            Outer(y=1)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'dataclass_type'

    References:
        - https://errors.pydantic.dev/2.10/v/dataclass_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#dataclass_type
    """

    date_from_datetime_inexact = PydanticError(
        template_en="Datetimes provided to dates should have zero time - e.g. be exact dates",
        template_zh_cn="提供给日期字段的 datetime 值应保持零时间分量（即必须是精确日期）",
    )
    """
    日期时间转换不精确错误

    This error is raised when the input `datetime` value provided for a `date` field has a nonzero time component.
    For a timestamp to parse into a field of type `date`, the time components must all be zero:

    Translation:
        当为 `date` 字段提供的 `datetime` 输入值包含非零时间分量时，会引发此错误。
        要将时间戳解析为 `date` 类型字段，时间分量必须全部为零。

    Examples:
        from datetime import date, datetime

        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: date

        Model(x='2023-01-01')  # OK
        Model(x=datetime(2023, 1, 1))  # OK

        try:
            Model(x=datetime(2023, 1, 1, 12))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'date_from_datetime_inexact'

    References:
        - https://errors.pydantic.dev/2.10/v/date_from_datetime_inexact
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#date_from_datetime_inexact
    """

    date_from_datetime_parsing = PydanticError(
        # template_en="Input should be a valid date or datetime, {error}",  # error 已手动移除
        template_en="Input should be a valid date or datetime",
        template_zh_cn="输入应为有效的日期或日期时间",
    )
    """
    日期解析错误

    This error is raised when the input value is a string that cannot be parsed for a `date` field:

    Translation:
        当输入值是无法解析为 `date` 字段的字符串时，会引发此错误。

    Examples:
        from datetime import date
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: date

        try:
            Model(x='XX1494012000')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'date_from_datetime_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/date_from_datetime_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#date_from_datetime_parsing
    """

    date_future = PydanticError(
        template_en="Date should be in the future",
        template_zh_cn="日期应为未来的时间",
    )
    """
    未来的日期错误

    This error is raised when the input value provided for a `FutureDate` field is not in the future:

    Translation:
        当为 `FutureDate` 字段提供的输入值不是未来时间时，会引发此错误。

    Examples:
        from datetime import date
        from pydantic import BaseModel, FutureDate, ValidationError

        class Model(BaseModel):
            x: FutureDate

        try:
            Model(x=date(2000, 1, 1))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'date_future'

    References:
        - https://errors.pydantic.dev/2.10/v/date_future
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#date_future
    """

    date_parsing = PydanticError(
        # template_en="Input should be a valid date in the format YYYY-MM-DD, {error}",  # error 已手动移除
        template_en="Input should be a valid date in the format YYYY-MM-DD",
        template_zh_cn="输入应为 YYYY-MM-DD 格式的有效日期",
    )
    """
    日期解析错误

    This error is raised when validating JSON where the input value is string that cannot be parsed for a `date` field:

    Translation:
        当验证 JSON 时，若输入值是无法解析为 `date` 字段的字符串，则会引发此错误。

    Examples:
        import json
        from datetime import date
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: date = Field(strict=True)

        try:
            Model.model_validate_json(json.dumps({'x': '1'}))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'date_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/date_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#date_parsing
    """

    date_past = PydanticError(
        template_en="Date should be in the past",
        template_zh_cn="日期应为过期的时间",
    )
    """
    过去的日期错误

    This error is raised when the value provided for a `PastDate` field is not in the past:

    Translation:
        当为 `PastDate` 字段提供的输入值不是过去时间时，会引发此错误。

    Examples:
        from datetime import date, timedelta
        from pydantic import BaseModel, PastDate, ValidationError

        class Model(BaseModel):
            x: PastDate

        try:
            Model(x=date.today() + timedelta(1))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'date_past'

    References:
        - https://errors.pydantic.dev/2.10/v/date_past
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#date_past
    """

    date_type = PydanticError(
        template_en="Input should be a valid date",
        template_zh_cn="输入应为有效的日期",
    )
    """
    日期类型错误

    This error is raised when the input value's type is not valid for a `date` field:
    This error is also raised for strict fields when the input value is not an instance of `date`.

    Translation:
        当输入值的类型不适用于 `date` 字段时，会引发此错误。  
        对于严格模式字段，当输入值不是 `date` 的实例时也会触发此错误。

    Examples:
        from datetime import date
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: date

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'date_type'

    References:
        - https://errors.pydantic.dev/2.10/v/date_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#date_type
    """

    datetime_from_date_parsing = PydanticError(
        # template_en="Input should be a valid datetime or date, {error}",  # error 已手动移除
        template_en="Input should be a valid datetime or date",
        template_zh_cn="输入应为有效的日期时间或日期",
    )
    """
    日期时间解析错误

    This error is raised when the input value is a string that cannot be parsed for a `datetime` field:

    Translation:
        当输入值是无法解析为 `datetime` 字段的字符串时，会引发此错误。

    Note:
        Support for this error, along with support for parsing datetimes from `yyyy-MM-DD` dates will be added in `v2.6.0`
        该错误的支持（以及从 `yyyy-MM-DD` 格式日期解析 datetime 的功能）将在 `v2.6.0` 版本中添加。

    Examples:
        from datetime import datetime
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: datetime

        try:
            # there is no 13th month
            Model(x='2023-13-01')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'datetime_from_date_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/datetime_from_date_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#datetime_from_date_parsing
    """

    datetime_future = PydanticError(
        template_en="Input should be in the future",
        template_zh_cn="输入应为未来的日期时间",
    )
    """
    未来的日期时间错误

    This error is raised when the value provided for a `FutureDatetime` field is not in the future:

    Translation:
        当为 `FutureDatetime` 字段提供的值不是未来时间时，会引发此错误。

    Examples:
        from datetime import datetime
        from pydantic import BaseModel, FutureDatetime, ValidationError

        class Model(BaseModel):
            x: FutureDatetime

        try:
            Model(x=datetime(2000, 1, 1))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'datetime_future'

    References:
        - https://errors.pydantic.dev/2.10/v/datetime_future
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#datetime_future
    """

    datetime_object_invalid = PydanticError(
        # template_en="Invalid datetime object, got {error}",  # error 已手动移除
        template_en="Invalid datetime object, got {error}",
        template_zh_cn="无效的 datetime 对象",
    )
    """
    日期时间对象无效错误

    This error is raised when something about the `datetime` object is not valid:

    Translation:
        当 `datetime` 对象存在无效内容时，会引发此错误。

    Examples:
        from datetime import datetime, tzinfo
        from pydantic import AwareDatetime, BaseModel, ValidationError

        class CustomTz(tzinfo):
            # utcoffset is not implemented!

            def tzname(self, _dt):
                return 'CustomTZ'

        class Model(BaseModel):
            x: AwareDatetime

        try:
            Model(x=datetime(2023, 1, 1, tzinfo=CustomTz()))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'datetime_object_invalid'

    References:
        - https://errors.pydantic.dev/2.10/v/datetime_object_invalid
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#datetime_object_invalid
    """

    datetime_parsing = PydanticError(
        # template_en="Input should be a valid datetime, {error}",  # error 已手动移除
        template_en="Input should be a valid datetime",
        template_zh_cn="输入应为有效的日期时间",
    )
    """
    日期时间解析错误

    This error is raised when the value is a string that cannot be parsed for a `datetime` field:

    Translation:
        当输入值是无法解析为 `datetime` 字段的字符串时，会引发此错误。

    Examples:
        import json
        from datetime import datetime
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: datetime = Field(strict=True)

        try:
            Model.model_validate_json(json.dumps({'x': 'not a datetime'}))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'datetime_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/datetime_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#datetime_parsing
    """

    datetime_past = PydanticError(
        template_en="Input should be in the past",
        template_zh_cn="输入应为过去的日期时间",
    )
    """
    过去的日期时间错误

    This error is raised when the value provided for a `PastDatetime` field is not in the past:

    Translation:
        当为 `PastDatetime` 字段提供的输入值不是过去时间时，会引发此错误。

    Examples:
        from datetime import datetime, timedelta
        from pydantic import BaseModel, PastDatetime, ValidationError

        class Model(BaseModel):
            x: PastDatetime

        try:
            Model(x=datetime.now() + timedelta(100))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'datetime_past'

    References:
        - https://errors.pydantic.dev/2.10/v/datetime_past
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#datetime_past
    """

    datetime_type = PydanticError(
        template_en="Input should be a valid datetime",
        template_zh_cn="输入应为有效的日期时间",
    )
    """
    日期时间类型错误

    This error is raised when the input value's type is not valid for a `datetime` field:
    This error is also raised for strict fields when the input value is not an instance of `datetime`.

    Translation:
        当输入值的类型不适用于 `datetime` 字段时，会引发此错误。  
        对于严格模式字段，当输入值不是 `datetime` 的实例时也会触发此错误。

    Examples:
        from datetime import datetime
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: datetime

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'datetime_type'

    References:
        - https://errors.pydantic.dev/2.10/v/datetime_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#datetime_type
    """

    decimal_max_digits = PydanticError(
        template_en="Decimal input should have no more than {max_digits} digits in total",
        template_zh_cn="小数输入的总位数不应超过 {max_digits} 位",
    )
    """
    小数位数过长错误

    This error is raised when the value provided for a `Decimal` has too many digits:

    Translation:
        当为 `Decimal` 提供的值位数过多时，会引发此错误。

    Examples:
        from decimal import Decimal
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: Decimal = Field(max_digits=3)

        try:
            Model(x='42.1234')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'decimal_max_digits'

    References:
        - https://errors.pydantic.dev/2.10/v/decimal_max_digits
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#decimal_max_digits
    """

    decimal_max_places = PydanticError(
        template_en="Decimal input should have no more than {decimal_places} decimal places",
        template_zh_cn="Decimal 输入的小数位不应超过 {decimal_places} 位",
    )
    """
    小数点后位数过多错误

    This error is raised when the value provided for a `Decimal` has too many digits after the decimal point:

    Translation:
        当为 `Decimal` 提供的值在小数点后位数过多时，会引发此错误。

    Examples:
        from decimal import Decimal
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: Decimal = Field(decimal_places=3)

        try:
            Model(x='42.1234')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'decimal_max_places'

    References:
        - https://errors.pydantic.dev/2.10/v/decimal_max_places
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#decimal_max_places
    """

    decimal_parsing = PydanticError(
        template_en="Input should be a valid decimal",
        template_zh_cn="输入应为有效的小数",
    )
    """
    小数解析错误

    This error is raised when the value provided for a `Decimal` could not be parsed as a decimal number:

    Translation:
        当为 `Decimal` 提供的值无法被解析为十进制数字时，会引发此错误。

    Examples:
        from decimal import Decimal
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: Decimal = Field(decimal_places=3)

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'decimal_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/decimal_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#decimal_parsing
    """

    decimal_type = PydanticError(
        template_en="Decimal input should be an integer, float, string or Decimal object",
        template_zh_cn="输入应为整数、浮点数、字符串或小数对象",
    )
    """
    小数类型错误

    This error is raised when the value provided for a `Decimal` is of the wrong type:
    This error is also raised for strict fields when the input value is not an instance of `Decimal`.

    Translation:
        当为 `Decimal` 提供的值类型错误时，会引发此错误。  
        对于严格模式字段，当输入值不是 `Decimal` 的实例时也会触发此错误。

    Examples:
        from decimal import Decimal
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: Decimal = Field(decimal_places=3)

        try:
            Model(x=[1, 2, 3])
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'decimal_type'

    References:
        - https://errors.pydantic.dev/2.10/v/decimal_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#decimal_type
    """

    decimal_whole_digits = PydanticError(
        template_en="Decimal input should have no more than {whole_digits} digits before the decimal point",
        template_zh_cn="输入的小数点前位数不应超过 {whole_digits} 位",
    )
    """
    小数总位数错误

    This error is raised when the value provided for a `Decimal` has more digits before the decimal 
    point than `max_digits` - `decimal_places` (as long as both are specified):
    This error is also raised for strict fields when the input value is not an instance of `Decimal`.

    Translation:
        当为 `Decimal` 提供的值在小数点前的位数超过 `max_digits` - `decimal_places` 的限制时（需同时指定这两个参数），会引发此错误。
        对于严格模式字段，若输入值不是 Decimal 的实例，同样会触发此错误。

    Examples:
        from decimal import Decimal
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: Decimal = Field(max_digits=6, decimal_places=3)

        try:
            Model(x='12345.6')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'decimal_whole_digits'

    References:
        - https://errors.pydantic.dev/2.10/v/decimal_whole_digits
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#decimal_whole_digits
    """

    dict_type = PydanticError(
        template_en="Input should be a valid dictionary",
        template_zh_cn="输入应为有效的字典",
    )
    """
    字典类型错误

    This error is raised when the input value's type is not `dict` for a `dict` field:

    Translation:
        当输入值的类型不是 `dict`（字典）时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: dict

        try:
            Model(x=['1', '2'])
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'dict_type'

    References:
        - https://errors.pydantic.dev/2.10/v/dict_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#dict_type
    """

    enum = PydanticError(
        template_en="Input should be {expected}",
        template_zh_cn="输入应为 {expected}",
    )
    """
    枚举错误

    This error is raised when the input value does not exist in an `enum` field members:

    Translation:
        当输入值不属于 `enum` 字段成员时，会引发此错误。

    Examples:
        from enum import Enum
        from pydantic import BaseModel, ValidationError

        class MyEnum(str, Enum):
            option = 'option'

        class Model(BaseModel):
            x: MyEnum

        try:
            Model(x='other_option')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'enum'

    References:
        - https://errors.pydantic.dev/2.10/v/enum
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#enum
    """

    extra_forbidden = PydanticError(
        template_en="Extra inputs are not permitted",
        template_zh_cn="禁止输入额外字段",
    )
    """
    额外的字段错误

    This error is raised when the input value contains extra fields, but `model_config['extra'] == 'forbid'`:

    Translation:
        当输入值包含额外字段且 `model_config['extra'] == 'forbid'` 时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ConfigDict, ValidationError

        class Model(BaseModel):
            x: str
        
            model_config = ConfigDict(extra='forbid')

        try:
            Model(x='test', y='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'extra_forbidden'

    References:
        - https://errors.pydantic.dev/2.10/v/extra_forbidden
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#extra_forbidden
    """

    finite_number = PydanticError(
        template_en="Input should be a finite number",
        template_zh_cn="输入应为有限数值",
    )
    """
    有限数值错误

    This error is raised when the value is infinite, or too large to be represented as a 64-bit 
    floating point number during validation:

    Translation:
        当验证过程中数值为无限大或超出 64 位浮点数表示范围时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: int

        try:
            Model(x=2.2250738585072011e308)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'finite_number'

    References:
        - https://errors.pydantic.dev/2.10/v/finite_number
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#finite_number
    """

    float_parsing = PydanticError(
        template_en="Input should be a valid number, unable to parse string as a number",
        template_zh_cn="输入应为有效数字，无法将字符串解析为数字",
    )
    """
    浮点数解析错误

    This error is raised when the value is a string that can't be parsed as a `float`:

    Translation:
        当输入值是无法解析为 `float` 的字符串时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: float

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'float_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/float_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#float_parsing
    """

    float_type = PydanticError(
        template_en="Input should be a valid number",
        template_zh_cn="输入应为有效数字",
    )
    """
    浮点数类型错误

    This error is raised when the input value's type is not valid for a `float` field:

    Translation:
        当输入值的类型不适用于 `float` 字段时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: float

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'float_type'

    References:
        - https://errors.pydantic.dev/2.10/v/float_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#float_type
    """

    frozen_field = PydanticError(
        template_en="Field is frozen",
        template_zh_cn="字段已冻结，无法修改",
    )
    """
    字段冻结错误

    This error is raised when you attempt to assign a value to a field with `frozen=True`, or to delete such a field:

    Translation:
        当尝试为 `frozen=True` 的字段赋值或删除此类字段时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: str = Field('test', frozen=True)

        model = Model()

        try:
            model.x = 'test1'
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'frozen_field'

        try:
            del model.x
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'frozen_field'

    References:
        - https://errors.pydantic.dev/2.10/v/frozen_field
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#frozen_field
    """

    frozen_instance = PydanticError(
        template_en="Instance is frozen",
        template_zh_cn="实例已冻结，无法修改",
    )
    """
    实例冻结错误

    This error is raised when `model_config['frozen] == True` and you attempt to delete or assign a new value to any of the fields:

    Translation:
        当 `model_config['frozen'] == True` 且你试图删除或为任何字段分配新值时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ConfigDict, ValidationError

        class Model(BaseModel):
            x: int

            model_config = ConfigDict(frozen=True)

        m = Model(x=1)

        try:
            m.x = 2
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'frozen_instance'

        try:
            del m.x
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'frozen_instance'

    References:
        - https://errors.pydantic.dev/2.10/v/frozen_instance
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#frozen_instance
    """

    frozen_set_type = PydanticError(
        template_en="Input should be a valid frozenset",
        template_zh_cn="输入应为有效的不可变集合",
    )
    """
    不可变集合类型错误

    This error is raised when the input value's type is not valid for a `frozenset` field:

    Translation:
        当输入值的类型不符合 frozenset 字段的类型要求时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: frozenset

        try:
            model = Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'frozen_set_type'

    References:
        - https://errors.pydantic.dev/2.10/v/frozen_set_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#frozen_set_type
    """

    get_attribute_error = PydanticError(
        # template_en="Error extracting attribute: {error}",  # error 已手动移除
        template_en="Error extracting attribute",  # TODO: error 需要去掉
        template_zh_cn="属性读取错误",
    )
    """
    属性读取错误

    This error is raised when `model_config['from_attributes'] == True` and an error is raised while reading the attributes:

    Translation:
        当 `model_config['from_attributes'] == True` 且在读取属性时发生错误时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ConfigDict, ValidationError

        class Foobar:
            def __init__(self):
                self.x = 1
 
            @property
            def y(self):
                raise RuntimeError('intentional error')

        class Model(BaseModel):
            x: int
            y: str
        
            model_config = ConfigDict(from_attributes=True)

        try:
            Model.model_validate(Foobar())
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'get_attribute_error'

    References:
        - https://errors.pydantic.dev/2.10/v/get_attribute_error
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#get_attribute_error
    """

    greater_than = PydanticError(
        template_en="Input should be greater than {gt}",
        template_zh_cn="输入应大于 {gt}",
    )
    """
    输入值大于错误

    This error is raised when the value is not greater than the field's `gt` constraint:

    Translation:
        当值不大于字段的 gt（大于）约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: int = Field(gt=10)

        try:
            Model(x=10)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'greater_than'

    References:
        - https://errors.pydantic.dev/2.10/v/greater_than
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#greater_than
    """

    greater_than_equal = PydanticError(
        template_en="Input should be greater than or equal to {ge}",
        template_zh_cn="输入应大于等于 {ge}",
    )
    """
    输入值大于等于错误

    This error is raised when the value is not greater than or equal to the field's `ge` constraint:

    Translation:
        当值不大于或等于字段的 ge（大于等于）约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: int = Field(ge=10)

        try:
            Model(x=9)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'greater_than_equal'

    References:
        - https://errors.pydantic.dev/2.10/v/greater_than_equal
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#greater_than_equal
    """

    int_from_float = PydanticError(
        template_en="Input should be a valid integer, got a number with a fractional part",
        template_zh_cn="输入应为有效的整数，但却得到了一个带有小数部分的数",
    )
    """
    整数输入小数错误

    This error is raised when you provide a `float` value for an `int` field:

    Translation:
        当为 int 类型的字段提供 float 类型的值时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: int

        try:
            Model(x=0.5)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'int_from_float'

    References:
        - https://errors.pydantic.dev/2.10/v/int_from_float
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#int_from_float
    """

    int_parsing = PydanticError(
        template_en="Input should be a valid integer, unable to parse string as an integer",
        template_zh_cn="输入应当是有效的整数，无法将字符串解析为整数。",
    )
    """
    整数解析错误

    This error is raised when the value can't be parsed as `int`:

    Translation:
        当无法将值解析为 `int` 类型时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: int

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'int_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/int_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#int_parsing
    """

    int_parsing_size = PydanticError(
        template_en="Unable to parse input string as an integer, exceeded maximum size",
        template_zh_cn="无法将输入字符串解析为整数，已超出最大尺寸限制。",
    )
    """
    整数解析范围错误

    This error is raised when attempting to parse a python or JSON value from a string 
    outside the maximum range that Python `str` to `int` parsing permits:

    Translation:
        当尝试从超出 Python `str` 到 `int` 解析允许的最大范围的字符串中解析 Python 或 JSON 值时，会引发此错误。

    Examples:
        import json
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: int

        # from Python
        assert Model(x='1' * 4_300).x == int('1' * 4_300)  # OK

        too_long = '1' * 4_301
        try:
            Model(x=too_long)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'int_parsing_size'

        # from JSON
        try:
            Model.model_validate_json(json.dumps({'x': too_long}))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'int_parsing_size'

    References:
        - https://errors.pydantic.dev/2.10/v/int_parsing_size
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#int_parsing_size
    """

    int_type = PydanticError(
        template_en="Input should be a valid integer",
        template_zh_cn="输入应为有效的整数",
    )
    """
    整数类型错误

    This error is raised when the input value's type is not valid for an `int` field:

    Translation:
        当输入值的类型不符合 `int` 字段的要求时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: int

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'int_type'

    References:
        - https://errors.pydantic.dev/2.10/v/int_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#int_type
    """

    invalid_key = PydanticError(
        template_en="Keys should be strings",
        template_zh_cn="键应为字符串类型。",
    )
    """
    无效的键错误

    This error is raised when attempting to validate a `dict` that has a key that is not an instance of `str`:

    Translation:
        当尝试验证一个 `dict`，而其中某个键并非 `str` 实例时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ConfigDict, ValidationError

        class Model(BaseModel):
            x: int
        
            model_config = ConfigDict(extra='allow')

        try:
            Model.model_validate({'x': 1, b'y': 2})
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'invalid_key'

    References:
        - https://errors.pydantic.dev/2.10/v/invalid_key
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#invalid_key
    """

    is_instance_of = PydanticError(
        template_en="Input should be an instance of {class}",
        template_zh_cn="输入应为 {class} 的实例",
    )
    """
    实例错误

    This error is raised when the input value is not an instance of the expected type:

    Translation:
        当输入值不是预期类型的实例时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ConfigDict, ValidationError

        class Nested:
            x: str

        class Model(BaseModel):
            y: Nested
        
            model_config = ConfigDict(arbitrary_types_allowed=True)

        try:
            Model(y='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'is_instance_of'

    References:
        - https://errors.pydantic.dev/2.10/v/is_instance_of
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#is_instance_of
    """

    is_subclass_of = PydanticError(
        template_en="Input should be a subclass of {class}",
        template_zh_cn="输入应为 {class} 的子类",
    )
    """
    子类错误

    This error is raised when the input value is not a subclass of the expected type:

    Translation:
        当输入值不是预期类型的子类时，会引发此错误。

    Examples:
        from typing import Type
        from pydantic import BaseModel, ValidationError

        class Nested:
            x: str

        class Model(BaseModel):
            y: type[Nested]

        try:
            Model(y='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'is_subclass_of'

    References:
        - https://errors.pydantic.dev/2.10/v/is_subclass_of
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#is_subclass_of
    """

    iterable_type = PydanticError(
        template_en="Input should be iterable",
        template_zh_cn="输入应为可迭代对象。",
    )
    """
    可迭代对象错误

    This error is raised when the input value is not valid as an `Iterable`:

    Translation:
        当输入值不符合 `Iterable` 的有效格式时，会引发此错误：

    Examples:
        from typing import Iterable
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            y: Iterable

        try:
            Model(y=123)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'iterable_type'

    References:
        - https://errors.pydantic.dev/2.10/v/iterable_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#iterable_type
    """

    iteration_error = PydanticError(
        # template_en="Error iterating over object, error: {error}",  # error 已手动移除
        template_en="Error iterating over object",
        template_zh_cn="迭代对象时发生错误",
    )
    """
    迭代错误

    This error is raised when an error occurs during iteration:

    Translation:
        当在迭代过程中发生错误时，会引发此错误。

    Examples:
        from typing import List
        from pydantic import BaseModel, ValidationError

        def gen():
            yield 1
            raise RuntimeError('error')

        class Model(BaseModel):
            x: ListInt

        try:
            Model(x=gen())
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'iteration_error'

    References:
        - https://errors.pydantic.dev/2.10/v/iteration_error
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#iteration_error
    """

    json_invalid = PydanticError(
        # template_en="Invalid JSON: {error}",  # error 已手动移除
        template_en="Invalid JSON",
        template_zh_cn="无效的 JSON 字符串",
    )
    """
    无效的 JSON 错误

    This error is raised when the input value is not a valid JSON string:

    Translation:
        当输入值不是有效的 JSON 字符串时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Json, ValidationError

        class Model(BaseModel):
            x: Json

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'json_invalid'

    References:
        - https://errors.pydantic.dev/2.10/v/json_invalid
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#json_invalid
    """

    json_type = PydanticError(
        template_en="JSON input should be string, bytes or bytearray",
        template_zh_cn="JSON 输入应为字符串、字节或字节数组",
    )
    """
    JSON 类型错误

    This error is raised when the input value is of a type that cannot be parsed as JSON:

    Translation:
        当输入值的类型无法被解析为 JSON 时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Json, ValidationError

        class Model(BaseModel):
            x: Json

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'json_type'

    References:
        - https://errors.pydantic.dev/2.10/v/json_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#json_type
    """

    less_than = PydanticError(
        template_en="Input should be less than {lt}",
        template_zh_cn="输入应小于 {lt}",
    )
    """
    输入值小于错误

    This error is raised when the input value is not less than the field's `lt` constraint:

    Translation:
        当输入值不小于字段的 `lt`（小于）约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: int = Field(lt=10)

        try:
            Model(x=10)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'less_than'

    References:
        - https://errors.pydantic.dev/2.10/v/less_than
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#less_than
    """

    less_than_equal = PydanticError(
        template_en="Input should be less than or equal to {le}",
        template_zh_cn="输入应小于等于 {le}",
    )
    """
    输入值小于等于错误

    This error is raised when the input value is not less than or equal to the field's `le` constraint:

    Translation:
        当输入值不小于或等于字段的 `le`（小于等于）约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: int = Field(le=10)

        try:
            Model(x=11)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'less_than_equal'

    References:
        - https://errors.pydantic.dev/2.10/v/less_than_equal
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#less_than_equal
    """

    list_type = PydanticError(
        template_en="Input should be a valid list",
        template_zh_cn="输入应为有效的列表",
    )
    """
    列表类型错误

    This error is raised when the input value's type is not valid for a `list` field:

    Translation:
        当输入值的类型不符合 `list` 字段的要求时，会引发此错误。

    Examples:
        from typing import List
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: ListInt

        try:
            Model(x=1)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'list_type'

    References:
        - https://errors.pydantic.dev/2.10/v/list_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#list_type
    """

    literal_error = PydanticError(
        template_en="Input should be {expected}",  # TODO: 拼接待优化 expected = "'a' or 'b'"
        template_zh_cn="输入应为 {expected}",
    )
    """
    字面量值错误

    This error is raised when the input value is not one of the expected literal values:

    Translation:
        当输入值不是预期的字面量值之一时，会引发此错误。

    Examples:
        from typing import Literal
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: Literal['a', 'b']

        Model(x='a')  # OK

        try:
            Model(x='c')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'literal_error'

    References:
        - https://errors.pydantic.dev/2.10/v/literal_error
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#literal_error
    """

    mapping_type = PydanticError(
        # template_en="Input should be a valid mapping, error: {error}",  # error 已手动移除
        template_en="Input should be a valid mapping",
        template_zh_cn="输入应为有效的映射对象（如字典）",
    )
    """
    映射类型错误

    This error is raised when a problem occurs during validation due to a failure in a call to 
    the methods from the `Mapping` protocol, such as `.items()`:

    Translation:
        当在验证过程中因调用 `Mapping` 协议的方法（如 `.items()`）失败而出现问题时，会引发此错误。

    Examples:
        from collections.abc import Mapping
        from typing import Dict
        from pydantic import BaseModel, ValidationError

        class BadMapping(Mapping):
            def items(self):
                raise ValueError()

            def __iter__(self):
                raise ValueError()

            def __getitem__(self, key):
                raise ValueError()

            def __len__(self):
                return 1

        class Model(BaseModel):
            x: DictStrStr

        try:
            Model(x=BadMapping())
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'mapping_type'

    References:
        - https://errors.pydantic.dev/2.10/v/mapping_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#mapping_type
    """

    missing = PydanticError(
        template_en="Field required",
        template_zh_cn="字段是必填的",
    )
    """
    必填字段未填错误

    This error is raised when there are required fields missing from the input value:

    Translation:
        当输入值中缺少必需字段时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: str

        try:
            Model()
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'missing'

    References:
        - https://errors.pydantic.dev/2.10/v/missing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#missing
    """

    missing_argument = PydanticError(
        template_en="Missing required argument",
        template_zh_cn="缺失必填参数",
    )
    """
    参数缺失错误

    This error is raised when a required positional-or-keyword argument is not passed to 
    a function decorated with `validate_call`:

    Translation:
        当使用 `validate_call` 装饰的函数缺少必需的位置或关键字参数时，会引发此错误。

    Examples:
        from pydantic import ValidationError, validate_call

        @validate_call
        def foo(a: int):
            return a
        
        
        try:
            foo()
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'missing_argument'

    References:
        - https://errors.pydantic.dev/2.10/v/missing_argument
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#missing_argument
    """

    missing_keyword_only_argument = PydanticError(
        template_en="Missing required keyword only argument",
        template_zh_cn="缺少必需的仅关键字参数",
    )
    """
    仅关键字参数缺失错误

    This error is raised when a required keyword-only argument is not passed to a function decorated with `validate_call`:

    Translation:
        当使用 `validate_call` 装饰的函数缺少必需的仅关键字参数时，会引发此错误。

    Examples:
        from pydantic import ValidationError, validate_call

        @validate_call
        def foo(*, a: int):
            return a

        try:
            foo()
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'missing_keyword_only_argument'

    References:
        - https://errors.pydantic.dev/2.10/v/missing_keyword_only_argument
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#missing_keyword_only_argument
    """

    missing_positional_only_argument = PydanticError(
        template_en="Missing required positional only argument",
        template_zh_cn="缺少必需的仅位置参数",
    )
    """
    仅位置参数缺失错误

    This error is raised when a required positional-only argument is not passed to a function decorated with `validate_call`:

    Translation:
        当使用 `validate_call` 装饰的函数缺少必需的仅位置参数时，会引发此错误。

    Examples:
        from pydantic import ValidationError, validate_call

        @validate_call
        def foo(a: int, /):
            return a

        try:
            foo()
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'missing_positional_only_argument'

    References:
        - https://errors.pydantic.dev/2.10/v/missing_positional_only_argument
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#missing_positional_only_argument
    """

    model_attributes_type = PydanticError(
        template_en="Input should be a valid dictionary or object to extract fields from",
        template_zh_cn="输入应为有效的字典或可从中提取字段的对象",
    )
    """
    模型属性类型错误

    This error is raised when the input value is not a valid dictionary, model instance, or instance 
    that fields can be extracted from:

    Translation:
        当输入值不是有效的字典、模型实例或无法从中提取字段的实例时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            a: int
            b: int

        # simply validating a dict
        print(Model.model_validate({'a': 1, 'b': 2}))
        #> a=1 b=2

        class CustomObj:
            def __init__(self, a, b):
                self.a = a
                self.b = b

        # using from attributes to extract fields from an objects
        print(Model.model_validate(CustomObj(3, 4), from_attributes=True))
        #> a=3 b=4

        try:
            Model.model_validate('not an object', from_attributes=True)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'model_attributes_type'

    References:
        - https://errors.pydantic.dev/2.10/v/model_attributes_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#model_attributes_type
    """

    model_type = PydanticError(
        template_en="Input should be a valid dictionary or instance of {class_name}",
        template_zh_cn="输入应为有效的字典或 {class_name} 类的实例",
    )
    """
    模型类型错误

    This error is raised when the input to a model is not an instance of the model or dict:

    Translation:
        当模型的输入既不是该模型的实例也不是字典时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            a: int
            b: int

        # simply validating a dict
        m = Model.model_validate({'a': 1, 'b': 2})
        print(m)
        #> a=1 b=2

        # validating an existing model instance
        print(Model.model_validate(m))
        #> a=1 b=2

        try:
            Model.model_validate('not an object')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'model_type'

    References:
        - https://errors.pydantic.dev/2.10/v/model_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#model_type
    """

    multiple_argument_values = PydanticError(
        template_en="Got multiple values for argument",
        template_zh_cn="为参数提供了多个值",
    )
    """
    多个参数值错误

    This error is raised when you provide multiple values for a single argument while calling 
    a function decorated with `validate_call`:

    Translation:
        当调用使用 `validate_call` 装饰的函数时，若为单个参数提供了多个值，则会引发此错误。

    Examples:
        from pydantic import ValidationError, validate_call

        @validate_call
        def foo(a: int):
            return a

        try:
            foo(1, a=2)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'multiple_argument_values'

    References:
        - https://errors.pydantic.dev/2.10/v/multiple_argument_values
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#multiple_argument_values
    """

    multiple_of = PydanticError(
        template_en="Input should be a multiple of {multiple_of}",
        template_zh_cn="输入值必须是 {multiple_of} 的倍数",
    )
    """
    倍数错误

    This error is raised when the input is not a multiple of a field's `multiple_of` constraint:

    Translation:
        当输入值不是字段 `multiple_of` 约束所指定数值的倍数时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: int = Field(multiple_of=5)

        try:
            Model(x=1)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'multiple_of'

    References:
        - https://errors.pydantic.dev/2.10/v/multiple_of
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#multiple_of
    """

    needs_python_object = PydanticError(
        template_en="Cannot check `{method_name}` when validating from json, use a JsonOrPython validator instead",
        template_zh_cn="当从 JSON 数据进行验证时，无法直接调用 {method_name}，需使用支持 JSON 解析的验证器（如 JsonOrPython）替代",
    )
    """
    需要 Python 对象错误

    This type of error is raised when validation is attempted from a format that cannot be converted to a Python object.
    For example, we cannot check `isinstance` or `issubclass` from JSON:

    Translation:
        当尝试从无法转换为 Python 对象的格式进行验证时，会引发此类错误。
        例如，无法对 JSON 数据执行 isinstance 或 issubclass 检查。

    Examples:
        import json
        from typing import Type
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            bm: type[BaseModel]

        try:
            Model.model_validate_json(json.dumps({'bm': 'not a basemodel class'}))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'needs_python_object'

    References:
        - https://errors.pydantic.dev/2.10/v/needs_python_object
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#needs_python_object
    """

    no_such_attribute = PydanticError(
        template_en="Object has no attribute '{attribute}'",
        template_zh_cn="对象没有 <{attribute}> 属性",
    )
    """
    对象属性不存在错误

    This error is raised when `validate_assignment=True` in the config, and you attempt to assign 
    a value to an attribute that is not an existing field:

    Translation:
        当在配置中设置 `validate_assignment=True` 且尝试为不存在的字段赋值时，会引发此错误

    Examples:
        from pydantic import ConfigDict, ValidationError, dataclasses

        @dataclasses.dataclass(config=ConfigDict(validate_assignment=True))
        class MyDataclass:
            x: int

        m = MyDataclass(x=1)
        try:
            m.y = 10
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'no_such_attribute'

    References:
        - https://errors.pydantic.dev/2.10/v/no_such_attribute
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#no_such_attribute
    """

    none_required = PydanticError(
        template_en="Input should be None",
        template_zh_cn="输入应为 None",
    )
    """
    输入不为 None 错误

    This error is raised when the input value is not `None` for a field that requires `None`:

    Translation:
        当某个字段要求值为 None，但输入的是非 None 值时，会引发此错误

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: None

        try:
            Model(x=1)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'none_required'

    References:
        - https://errors.pydantic.dev/2.10/v/none_required
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#none_required
    """

    recursion_loop = PydanticError(
        template_en="Recursion error - cyclic reference detected",
        template_zh_cn="递归错误 - 检测到循环引用",
    )
    """
    循环引用错误

    This error is raised when a cyclic reference is detected:

    Translation:
        当检测到循环引用时，会引发此错误

    Examples:
        from typing import List
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: list['Model']

        d = {'x': []}
        d['x'].append(d)
        try:
            Model(**d)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'recursion_loop'

    References:
        - https://errors.pydantic.dev/2.10/v/recursion_loop
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#recursion_loop
    """

    set_type = PydanticError(
        template_en="Input should be a valid set",
        template_zh_cn="输入应为有效的集合",
    )
    """
    集合类型错误

    This error is raised when the value type is not valid for a `set` field:

    Translation:
        当值的类型对于集合（set）字段无效时，会引发此错误。

    Examples:
        from typing import Set
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: Set[int]

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'set_type'

    References:
        - https://errors.pydantic.dev/2.10/v/set_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#set_type
    """

    string_pattern_mismatch = PydanticError(
        template_en="String should match pattern '{pattern}'",
        template_zh_cn="字符串应匹配模式 '{pattern}'",
    )
    """
    字符串模式不匹配错误

    This error is raised when the input value doesn't match the field's `pattern` constraint:

    Translation:
        当输入值不符合字段的 `pattern` 约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: str = Field(pattern='test')

        try:
            Model(x='1')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'string_pattern_mismatch'

    References:
        - https://errors.pydantic.dev/2.10/v/string_pattern_mismatch
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#string_pattern_mismatch
    """

    string_sub_type = PydanticError(
        template_en="",  # TODO: 运行无报错，无法复现
        template_zh_cn="",
    )
    """
    字符串子类型错误

    This error is raised when the value is an instance of a strict subtype of `str` when the field is strict:

    Translation:
        当字段为严格类型时，如果值是 `str` 的严格子类型的实例，则会引发此错误。

    Examples:
        from enum import Enum
        from pydantic import BaseModel, Field, ValidationError

        class MyEnum(str, Enum):
            foo = 'foo'

        class Model(BaseModel):
            x: str = Field(strict=True)

        try:
            Model(x=MyEnum.foo)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'string_sub_type'

    References:
        - https://errors.pydantic.dev/2.10/v/string_sub_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#string_sub_type
    """

    string_too_long = PydanticError(
        template_en="String should have at most {max_length} characters",
        template_zh_cn="字符串的长度最多应为 {max_length} 个字符",
    )
    """
    字符串长度过长错误

    This error is raised when the input value is a string whose length is greater than the field's `max_length` constraint:

    Translation:
        中文翻译当输入值是一个字符串，但其长度超过了字段的 `max_length` 约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: str = Field(max_length=3)

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'string_too_long'

    References:
        - https://errors.pydantic.dev/2.10/v/string_too_long
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#string_too_long
    """

    string_too_short = PydanticError(
        template_en="String should have at least {min_length} characters",
        template_zh_cn="字符串的长度至少应为 {min_length} 个字符",
    )
    """
    字符串长度过端错误

    This error is raised when the input value is a string whose length is less than the field's `min_length` constraint:

    Translation:
        当输入值为字符串且其长度小于字段的 `min_length` 约束时，会引发此错误。

    Examples:
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: str = Field(min_length=3)

        try:
            Model(x='t')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'string_too_short'

    References:
        - https://errors.pydantic.dev/2.10/v/string_too_short
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#string_too_short
    """

    string_type = PydanticError(
        template_en="Input should be a valid string",
        template_zh_cn="输入应为有效的字符串",
    )
    """
    字符串类型错误

    This error is raised when the input value's type is not valid for a `str` field:
    This error is also raised for strict fields when the input value is not an instance of `str`.

    Translation:
        当输入值的类型对于 `str` 字段无效时，会引发此错误。
        当严格字段的输入值不是 `str` 的实例时，也会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: str

        try:
            Model(x=1)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'string_type'

    References:
        - https://errors.pydantic.dev/2.10/v/string_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#string_type
    """

    string_unicode = PydanticError(
        template_en="Input should be a valid string, unable to parse raw data as a unicode string",
        template_zh_cn="输入应为有效字符串，无法将原始数据解析为 Unicode 字符串。",
    )
    """
    字符串 Unicode 解析错误

    This error is raised when the value cannot be parsed as a Unicode string:

    Translation:
        当值无法被解析为 Unicode 字符串时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: str

        try:
            Model(x=b'\x81')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'string_unicode'

    References:
        - https://errors.pydantic.dev/2.10/v/string_unicode
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#string_unicode
    """

    time_delta_parsing = PydanticError(
        # template_en="Input should be a valid timedelta, {error}",  # error 已手动移除
        template_en="Input should be a valid timedelta",
        template_zh_cn="输入应为有效的时间间隔",
    )
    """
    时间间隔解析错误

    This error is raised when the input value is a string that cannot be parsed for a `timedelta` field:

    Translation:
        当输入值是一个无法被解析为 `timedelta` 字段的字符串时，会引发此错误。

    Examples:
        from datetime import timedelta
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: timedelta

        try:
            Model(x='t')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'time_delta_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/time_delta_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#time_delta_parsing
    """

    time_delta_type = PydanticError(
        template_en="Input should be a valid timedelta",
        template_zh_cn="输入应为有效的时间间隔",
    )
    """
    时间间隔类型错误

    This error is raised when the input value's type is not valid for a `timedelta` field:
    This error is also raised for strict fields when the input value is not an instance of `timedelta`.

    Translation:
        当输入值的类型对于 `timedelta` 字段无效时，会引发此错误。
        当严格字段的输入值不是 `timedelta` 的实例时，同样会引发此错误。

    Examples:
        from datetime import timedelta
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: timedelta

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'time_delta_type'

    References:
        - https://errors.pydantic.dev/2.10/v/time_delta_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#time_delta_type
    """

    time_parsing = PydanticError(
        # template_en="Input should be in a valid time format, {error}",  # error 已手动移除
        template_en="Input should be in a valid time format",
        template_zh_cn="输入应为有效的时间格式",
    )
    """
    时间解析错误

    This error is raised when the input value is a string that cannot be parsed for a `time` field:

    Translation:
        当输入值是一个无法被解析为 `time` 字段的字符串时，会引发此错误。

    Examples:
        from datetime import time
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: time

        try:
            Model(x='25:20:30.400')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'time_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/time_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#time_parsing
    """

    time_type = PydanticError(
        template_en="Input should be a valid time",
        template_zh_cn="输入应为有效的时间",
    )
    """
    时间类型错误

    This error is raised when the value type is not valid for a `time` field:
    This error is also raised for strict fields when the input value is not an instance of `time`.

    Translation:
        当输入值的类型对于 `time` 字段无效时，会引发此错误。
        当严格字段的输入值不是 `time` 的实例时，同样会引发此错误。

    Examples:
        from datetime import time
        
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: time

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'time_type'

    References:
        - https://errors.pydantic.dev/2.10/v/time_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#time_type
    """

    timezone_aware = PydanticError(
        template_en="Input should have timezone info",
        template_zh_cn="输入应包含时区信息",
    )
    """
    时区感知错误

    This error is raised when the `datetime` value provided for a timezone-aware `datetime` 
    field doesn't have timezone information:

    Translation:
        当为需要时区信息的 `datetime` 字段提供的 `datetime` 值未包含时区信息时，会引发此错误。

    Examples:
        from datetime import datetime
        from pydantic import AwareDatetime, BaseModel, ValidationError

        class Model(BaseModel):
            x: AwareDatetime

        try:
            Model(x=datetime.now())
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'timezone_aware'

    References:
        - https://errors.pydantic.dev/2.10/v/timezone_aware
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#timezone_aware
    """

    timezone_naive = PydanticError(
        template_en="Input should not have timezone info",
        template_zh_cn="输入不应包含时区信息",
    )
    """
    无时区信息错误

    This error is raised when the `datetime` value provided for a timezone-naive `datetime` field has timezone info:

    Translation:
        当为不包含时区信息的 `datetime` 字段提供的 `datetime` 值包含时区信息时，会引发此错误。

    Examples:
        from datetime import datetime, timezone
        from pydantic import BaseModel, NaiveDatetime, ValidationError

        class Model(BaseModel):
            x: NaiveDatetime

        try:
            Model(x=datetime.now(tz=timezone.utc))
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'timezone_naive'

    References:
        - https://errors.pydantic.dev/2.10/v/timezone_naive
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#timezone_naive
    """

    too_long = PydanticError(
        # template_en="{field_type} should have at most {max_length} items after validation, not {actual_length}",  # TODO: field_type 需要手动映射
        template_en="{field_type} should have at most {max_length} items after validation, not {actual_length}",
        template_zh_cn="{field_type} 最多应有 {max_length} 个元素，而非 {actual_length} 个",
    )
    """
    元素过长错误

    This error is raised when the input value's length is greater than the field's `max_length` constraint:

    Translation:
        当输入值的长度超过字段的 `max_length` 约束时，会引发此错误。

    Examples:
        from typing import List
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: ListInt = Field(max_length=3)

        try:
            Model(x=[1, 2, 3, 4])
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'too_long'

    References:
        - https://errors.pydantic.dev/2.10/v/too_long
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#too_long
    """

    too_short = PydanticError(
        # template_en="{field_type} should have at least {min_length} items after validation, not {actual_length}",  # TODO: field_type 需要手动映射
        template_en="{field_type} should have at least {min_length} items after validation, not {actual_length}",
        template_zh_cn="{field_type} 至少应有 {min_length} 个元素，而非 {actual_length} 个",
    )
    """
    元素过短错误

    This error is raised when the value length is less than the field's `min_length` constraint:

    Translation:
        当值的长度小于字段的 `min_length` 约束时，会引发此错误。

    Examples:
        from typing import List
        from pydantic import BaseModel, Field, ValidationError

        class Model(BaseModel):
            x: ListInt = Field(min_length=3)

        try:
            Model(x=[1, 2])
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'too_short'

    References:
        - https://errors.pydantic.dev/2.10/v/too_short
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#too_short
    """

    tuple_type = PydanticError(
        template_en="Input should be a valid tuple",
        template_zh_cn="输入应为有效的元组",
    )
    """
    元组类型错误

    This error is raised when the input value's type is not valid for a `tuple` field:
    This error is also raised for strict fields when the input value is not an instance of `tuple`.

    Translation:
        当输入值的类型对于 `tuple` 字段无效时，会引发此错误。
        当严格字段的输入值不是 `tuple` 的实例时，同样会引发此错误。

    Examples:
        from typing import Tuple
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            x: TupleInt

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'tuple_type'

    References:
        - https://errors.pydantic.dev/2.10/v/tuple_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#tuple_type
    """

    unexpected_keyword_argument = PydanticError(
        template_en="Unexpected keyword argument",
        template_zh_cn="出现了意外的关键字参数",
    )
    """
    意外的关键字参数错误

    This error is raised when you provide a value by keyword for a positional-only argument while calling 
    a function decorated with `validate_call`:

    Translation:
        当你在调用使用 `validate_call` 装饰的函数时，为仅位置参数通过关键字方式提供值，会引发此错误。

    Examples:
        from pydantic import ValidationError, validate_call

        @validate_call
        def foo(a: int, /):
            return a

        try:
            foo(a=2)
        except ValidationError as exc:
            print(repr(exc.errors()[1]['type']))
            #> 'unexpected_keyword_argument'

    References:
        - https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#unexpected_keyword_argument
    """

    unexpected_positional_argument = PydanticError(
        template_en="Unexpected positional argument",
        template_zh_cn="出现了意外的位置参数",
    )
    """
    意外的位置参数错误

    This error is raised when you provide a positional value for a keyword-only argument while calling 
    a function decorated with `validate_call`:

    Translation:
        当你在调用使用 `validate_call` 装饰的函数时，为仅关键字参数提供位置参数值，会引发此错误。

    Examples:
        from pydantic import ValidationError, validate_call

        @validate_call
        def foo(*, a: int):
            return a

        try:
            foo(2)
        except ValidationError as exc:
            print(repr(exc.errors()[1]['type']))
            #> 'unexpected_positional_argument'

    References:
        - https://errors.pydantic.dev/2.10/v/unexpected_positional_argument
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#unexpected_positional_argument
    """

    union_tag_invalid = PydanticError(
        template_en="Input tag '{tag}' found using '{discriminator}' does not match any of the expected tags: '{expected_tags}'",
        template_zh_cn="使用判别器 `{discriminator}` 找到的输入标签 `{tag}` 预期标签 `{expected_tags}` 不匹配",
    )
    """
    联合类型标签无效错误

    This error is raised when the input's discriminator is not one of the expected values:

    Translation:
        当输入的判别器值不在预期值列表中时，会引发此错误。

    Examples:
        from typing import Literal, Union
        from pydantic import BaseModel, Field, ValidationError

        class BlackCat(BaseModel):
            pet_type: Literal['blackcat']

        class WhiteCat(BaseModel):
            pet_type: Literal['whitecat']

        class Model(BaseModel):
            cat: Union[BlackCat, WhiteCat] = Field(discriminator='pet_type')

        try:
            Model(cat={'pet_type': 'dog'})
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'union_tag_invalid'

    References:
        - https://errors.pydantic.dev/2.10/v/union_tag_invalid
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#union_tag_invalid
    """

    union_tag_not_found = PydanticError(
        template_en="Unable to extract tag using discriminator '{discriminator}'",
        template_zh_cn="无法使用判别字段 '{discriminator}' 提取类型标签",
    )
    """
    联合类型标签未找到错误

    This error is raised when it is not possible to extract a discriminator value from the input:

    Translation:
        当无法从输入数据中提取判别字段值时，会引发此错误。

    Examples:
        from typing import Literal, Union
        from pydantic import BaseModel, Field, ValidationError

        class BlackCat(BaseModel):
            pet_type: Literal['blackcat']

        class WhiteCat(BaseModel):
            pet_type: Literal['whitecat']

        class Model(BaseModel):
            cat: Union[BlackCat, WhiteCat] = Field(discriminator='pet_type')

        try:
            Model(cat={'name': 'blackcat'})
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'union_tag_not_found'

    References:
        - https://errors.pydantic.dev/2.10/v/union_tag_not_found
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#union_tag_not_found
    """

    url_parsing = PydanticError(
        # template_en="Input should be a valid URL, {error}",  # error 已手动移除
        template_en="Input should be a valid URL",
        template_zh_cn="输入应为有效的 URL",
    )
    """
    URL 解析错误

    This error is raised when the input value cannot be parsed as a URL:

    Translation:
        当输入值无法被解析为合法 URL 时引发此错误。

    Examples:
        from pydantic import AnyUrl, BaseModel, ValidationError

        class Model(BaseModel):
            x: AnyUrl

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'url_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/url_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#url_parsing
    """

    url_scheme = PydanticError(
        template_en="URL scheme should be {expected_schemes}",
        template_zh_cn="URL 协议应为 {expected_schemes}",
    )
    """
    URL 协议错误

    This error is raised when the URL scheme is not valid for the URL type of the field:

    Translation:
        当字段要求的URL类型与输入的 URL 协议（scheme）不匹配时，会引发此错误。

    Examples:
        from pydantic import BaseModel, HttpUrl, ValidationError

        class Model(BaseModel):
            x: HttpUrl

        try:
            Model(x='ftp://example.com')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'url_scheme'

    References:
        - https://errors.pydantic.dev/2.10/v/url_scheme
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#url_scheme
    """

    url_syntax_violation = PydanticError(
        # template_en="Input violated strict URL syntax rules, {error}",  # error 已手动移除
        template_en="Input violated strict URL syntax rules",
        template_zh_cn="URL 语法错误",
    )
    """
    URL 语法无效错误

    This error is raised when the URL syntax is not valid:

    Translation:
        当 URL 语法不符合规范时引发此错误。

    Examples:
        from pydantic import BaseModel, Field, HttpUrl, ValidationError

        class Model(BaseModel):
            x: HttpUrl = Field(strict=True)

        try:
            Model(x='http:////example.com')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'url_syntax_violation'

    References:
        - https://errors.pydantic.dev/2.10/v/url_syntax_violation
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#url_syntax_violation
    """

    url_too_long = PydanticError(
        template_en="URL should have at most {max_length} characters",
        template_zh_cn="URL 最大长度限制为 {max_length} 个字符",
    )
    """
    URL 长度过长错误

    This error is raised when the URL length is greater than 2083:

    Translation:
        当 URL 长度超过 2083 个字符时，会引发此错误。

    Examples:
        from pydantic import BaseModel, HttpUrl, ValidationError

        class Model(BaseModel):
            x: HttpUrl

        try:
            Model(x='x' * 2084)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'url_too_long'

    References:
        - https://errors.pydantic.dev/2.10/v/url_too_long
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#url_too_long
    """

    url_type = PydanticError(
        template_en="URL input should be a string or URL",
        template_zh_cn="URL 输入应为字符串或 URL 对象",
    )
    """
    URL 类型错误

    This error is raised when the input value's type is not valid for a URL field:

    Translation:
        当输入值类型不符合URL字段要求时，会引发此错误。

    Examples:
        from pydantic import BaseModel, HttpUrl, ValidationError

        class Model(BaseModel):
            x: HttpUrl

        try:
            Model(x=None)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'url_type'

    References:
        - https://errors.pydantic.dev/2.10/v/url_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#url_type
    """

    uuid_parsing = PydanticError(
        # template_en="Input should be a valid UUID, {error}",  # error 已手动移除
        template_en="Input should be a valid UUID",
        template_zh_cn="输入应为有效的 UUID 格式",
    )
    """
    UUID 解析错误

    This error is raised when the input value's type is not valid for a UUID field:

    Translation:
        当输入值的类型不符合 UUID 字段要求时，会引发此错误。

    Examples:
        from uuid import UUID
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            u: UUID

        try:
            Model(u='12345678-124-1234-1234-567812345678')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'uuid_parsing'

    References:
        - https://errors.pydantic.dev/2.10/v/uuid_parsing
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#uuid_parsing
    """

    uuid_type = PydanticError(
        template_en="UUID input should be a string, bytes or UUID object",
        template_zh_cn="UUID 输入必须是字符串、字节或 UUID 对象",
    )
    """
    UUID 类型错误

    This error is raised when the input value's type is not valid instance for a UUID field (str, bytes or UUID):

    Translation:
        当输入值的类型不符合UUID字段的要求（应为字符串、字节或UUID对象）时，会引发此错误。

    Examples:
        from uuid import UUID
        from pydantic import BaseModel, ValidationError

        class Model(BaseModel):
            u: UUID

        try:
            Model(u=1234567812412341234567812345678)
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'uuid_type'

    References:
        - https://errors.pydantic.dev/2.10/v/uuid_type
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#uuid_type
    """

    uuid_version = PydanticError(
        template_en="UUID version {expected_version} expected",
        template_zh_cn="UUID 版本应为 {expected_version}",
    )
    """
    UUID 版本错误

    This error is raised when the input value's type is not match UUID version:

    Translation:
        当输入值的UUID版本不匹配时，会引发此错误。

    Examples:
        from pydantic import UUID5, BaseModel, ValidationError

        class Model(BaseModel):
            u: UUID5

        try:
            Model(u='a6cc5730-2261-11ee-9c43-2eb5a363657c')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'uuid_version'

    References:
        - https://errors.pydantic.dev/2.10/v/uuid_version
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#uuid_version
    """

    value_error = PydanticError(
        template_en="Value error, {error}",
        template_zh_cn="{error}",  # 不做任何处理，直接抛出用户自定义的错误信息
    )
    """
    值错误

    This error is raised when a `ValueError` is raised during validation:

    Translation:
        在校验过程中触发 `ValueError` 时，会引发此错误。

    Examples:
        from pydantic import BaseModel, ValidationError, field_validator

        class Model(BaseModel):
            x: str

            @field_validator('x')
            @classmethod
            def repeat_b(cls, v):
                raise ValueError()

        try:
            Model(x='test')
        except ValidationError as exc:
            print(repr(exc.errors()[0]['type']))
            #> 'value_error'

    References:
        - https://errors.pydantic.dev/2.10/v/value_error
        - https://docs.pydantic.dev/2.10/errors/validation_errors/#value_error
    """

    @classmethod
    def get_code_2_template_zh_cn(cls) -> DictStrStr:
        """ 返回 Code-Template 映射 """

        return {
            _code: _error.template_zh_cn
            for _code, _error in cls.__dict__.items()
            if isinstance(_error, PydanticError)
        }


if __name__ == '__main__':
    res = PydanticErrorCollection.get_code_2_template_zh_cn()
    debug(res)
